<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script>
        var a = [3, 'a', 'a', 'a', 2, 3, 'a', 3, 'a', 2, 4, 9, 3];
        // should output: 'a'
        function most(arrays){
            var obj = {},max =0,maxEle;
            for(var i=0;i<arrays.length;i++){
                var val = arrays[i]
                obj[val]===undefined?obj[val] = 1:obj[val]++;
                if(obj[val]>max){
                    max = obj[val]
                    maxEle = val
                }
            }
            return `${maxEle}`
        }
        console.log(most(a))
    </script>
</head>
<body>

</body>
</html>